import * as types from '@src/model/actionType';
import { combineReducers } from 'redux';

// 交易详情
const txDetailState = {
  SalePrice: '10元/件',
  Business: '微软',
  Producer: '谷歌',
  Storage: '20个',
  Spec: '1001002',
  Warehouse: '仓库',
  Delivery: '90天',
  IsNew: true,
  TxId: 'chain1',
  TxHash: 'asdh123123',
  BlockHash: 'asdh123123',
  BlockHeight: 5,
  Sender: 'common',
  ContractName: 'asset',
  ContractVersion: 'v1.0.0',
  TxStatusCode: 'success',
  ContractResultCode: 'OK',
  RwSetHash: 'fa11a5f1',
  ContractMethod: 'add_evidence',
  ContractParameters:
    '[{"key":"app_id","value":"20051500011"},{"key":"evi_id","value":"5c7100e1d62745d3ab8a91184be3fcca"}]',
  Timestamp: 1606669261,
  ContractResult: '',
};

function txDetail(state = txDetailState, action) {
  switch (action.type) {
    case types.txDetail:
      return { ...state, ...action.payload };
    default:
      return state;
  }
}

const reducer = combineReducers({
  txDetail,
});

export default reducer;
